<% include ../pageHeader %>
<%

var strPageLinks = "";
if (intPageSize > 0) {
    strPageLinks = helper.generatePageLinks(intEntryCount, intPageSize, intCurrentPage, 15, "?id=" + theArticle.id,
            "#comments");
}
%>
<div id="mainWrapper">
    <div id="content" class="content">
        <div id="innerContent">
            <div class="article-top">
                <div class="prev-article">
                    <% if(theArticle.prevArticle){ %>
                    <a href="?id=<%= theArticle.prevArticle.id %>"
                       title="<%= helper.HTMLEncode(theArticle.prevArticle.title) %>">&laquo; <%= helper.HTMLEncode(
                                helper.cutString(theArticle.prevArticle.title, 20)) %></a>
                    <% } %>
                </div>
                <div class="next-article">
                    <% if(theArticle.nextArticle){ %>
                    <a href="?id=<%= theArticle.nextArticle.id %>"
                       title="<%= helper.HTMLEncode(theArticle.nextArticle.title) %>"><%= helper.HTMLEncode(
                                helper.cutString(theArticle.nextArticle.title, 20)) %> &raquo;</a>
                    <% } %>
                </div>
                <div class="category-label"><a
                            href="default.asp?cat=<%= theArticle.category.id %>"><%= __('category') %>
                        : <%= helper.HTMLEncode(theArticle.category.name) %></a></div>
            </div>
            <div class="textbox">
                <div class="textbox-title">
                    <% if(theArticle.selected){ %>
                    <img src="/public/<%= theCache.settings["imageFolder"] %>/icon_star.gif" alt="<%= __('selected') %>"/>
                    <% } %>
                    <% if(theArticle.locked || theArticle.category.locked){ %>
                    <img src="/public/<%= theCache.settings["imageFolder"] %>/icon_lock.gif" alt="<%= __('locked') %>"/>
                    <% } %>
                    <h4><%= helper.HTMLEncode(theArticle.title) %></h4>
                    <div class="textbox-label">
                        [ <%= helper.getDateTimeString("YY-MM-DD hh:ii:ss", theArticle.postTime) %>| <%= __('author') %>
                        : <a href='user.asp?act=view&amp;id=<%= theArticle.authorID %>'><%= theArticle.author %></a>
                        <% if(theUser.groupID == 1){ %>
                        | <%= theArticle.IP %>
                        <% } %>
                        ]
                        <% if(theUser.rights["edit"] > 1 ||
                                (theUser.rights["edit"] == 1 && theUser.username == theArticle.author)){ %>
                        &nbsp;<a href="?act=edit&amp;id=<%= theArticle.id %>" title="<%= lang['edit'] %>"><img
                                    src="/public/<%= theCache.settings["imageFolder"] %>/icon_edit.gif"
                                    alt="<%= lang['edit'] %>"/></a>
                        <% } %>
                        <% if(theUser.rights["delete"] > 1 ||
                                (theUser.rights["delete"] == 1 && theUser.username == theArticle.author)){ %>
                        &nbsp;<a href="?act=delete&amp;id=<%= theArticle.id %>" title="<%= lang['delete'] %>"
                                 onclick="return confirm('<%= __('confirm_delete_article') %>?')"><img
                                    src="/public/<%= theCache.settings["imageFolder"] %>/icon_del.gif"
                                    alt="<%= lang['delete'] %>"/></a>
                        <% } %>
                    </div>
                </div>
                <div class="textbox-fontsize">
                    <%= __('font_size') %>:
                    <a href="javascript:setFontSize(14)"
                       title="<%= __('font_size') %>: <%= __('large') %>"><%= __('large') %></a> |
                    <a href="javascript:setFontSize(11)"
                       title="<%= __('font_size') %>: <%= __('medium') %>"><%= __('medium') %></a> |
                    <a href="javascript:setFontSize(9)"
                       title="<%= __('font_size') %>: <%= __('small') %>"><%= __('small') %></a>
                </div>
                <div id="textboxContent" class="textbox-content">
                    <% if(theArticle.ubbFlags == "html"){ %>
                    <%= (theArticle.content0 + theArticle.content1).replace(/\[separator\]/ig, "") %>
                    <% }else{ %>
                    <%= ubb.toHTML(helper.HTMLEncode(theArticle.content0 + theArticle.content1), theArticle.ubbFlags) %>
                    <% } %>
                    <% if(theArticle.editMark){
                        var arrEdit = theArticle.editMark.split("$|$");
                    %>
                    <div class="editmark">[<%= __('edited_by')+arrEdit[0]+__('at')+arrEdit[1] %>]</div>
                    <% } %>
                    <div class="textbox-urls">
                        <img src="/public/<%= theCache.settings["imageFolder"] %>/rss_comment.png" class="meta-button"
                             alt="<%= __('comment_feed') %>"/>
                        <b><%= __('comment_feed') %>:</b> <%= theCache.settings["baseURL"]+
                        "feed.asp?q=comment&amp;id="+theArticle.id %>
                        <% if(theCache.settings["enableTrackbackIn"] == 1 && !theArticle.locked && theArticle.mode <
                                4){ %>
                        <br/>
                        <img src="/public/<%= theCache.settings["imageFolder"] %>/utf8.png" class="meta-button"
                             alt="UTF-8 Encoding"/> <b><%= __('trackback_url') %>
                            :</b> <%= theCache.settings["baseURL"]+"trackback.asp?id="+theArticle.id %>
                        <% } %>
                    </div>
                </div>
            </div>
            <br/>
            <script type="text/javascript" language="javascript" src="/public/common.js"></script>
            <a name="comments"></a>
            <div id="commentWrapper" class="comment-wrapper">
                <% if(theArticle.comments){
                %>
                <div id="commentTop" class="comment-top"><%= __('view_mode') %>: <a
                            href="javascript:toggleComments(true,true);"><%= __('show_all') %></a> |
                    <a href="javascript:toggleComments(true,false);"><%= __('comments') %>
                        : <%= theArticle.commentCount %></a> |
                    <% if(theCache.settings["showTrackbackWithComment"] == 1){ %>
                    <a href="javascript:toggleComments(false,true);">
                        <% }else{ %>
                        <a href="trackback.asp?act=list&amp;id=<%= theArticle.id %>" target="_blank">
                            <% } %>
                            <%= __('trackbacks') %>: <%= theArticle.trackbackCount %></a> | <a
                                href="javascript:toggleOrder();"><%= __('toggle_order') %></a> | <%= __('views') %>
                        : <%= theArticle.viewCount %></div>
                <% if(intPageSize > 0){ %>
                <div class="comment-pages">
                    <%= strPageLinks %>
                </div>
                <% } %>
                <%
                for(var i = 0;i < theArticle.comments.length;i++){
                        with(theArticle.comments[i]){
                if(type == 0){ %>
                <div class="commentbox" id="comment<%= id %>">
                    <a name="comment<%= id %>"></a>
                    <div class="commentbox-title">
                        <a href="javascript:doQuote('comm_<%= id %>','<%= author %>')"><img
                                    src="/public/<%= theCache.settings["imageFolder"] %>/icon_quote<% if(authorID ==
                                            theArticle.authorID)write("_author") %>.gif"
                                    alt="<%= __('quote') %>"/></a>
                        <b><a href="user.asp?act=view&amp;id=<%= authorID %>"><%= author %>
                                <% if(authorID == 0)write("*") %>
                            </a></b>
                        <div class="commentbox-label">
                            [ <%= helper.getDateTimeString("YY-MM-DD hh:ii:ss", postTime) %>
                            <% if(theUser.groupID == 1){ %>
                            | <%= IP %>
                            <% } %>
                            ]
                            <% if(theUser.loggedIn && (theUser.rights["edit"] > 1 || (theUser.rights["edit"] == 1 &&
                                    (theUser.id == theArticle.authorID || theUser.id == authorID)))){ %>
                            &nbsp;<a href="comment.asp?act=edit&amp;id=<%= id %>" title="<%= lang['edit'] %>"><img
                                        src="/public/<%= theCache.settings["imageFolder"] %>/icon_edit.gif"
                                        alt="<%= lang['edit'] %>"/></a>
                            <% } %>
                            <% if(theUser.loggedIn && (theUser.rights["delete"] > 1 || (theUser.rights["delete"] == 1 &&
                                    (theUser.id == theArticle.authorID || theUser.id == authorID)))){ %>
                            &nbsp;<a href="comment.asp?act=delete&amp;id=<%= id %>" title="<%= lang['delete'] %>"
                                     onclick="return confirm('<%= __('confirm_delete_comment') %>?')"><img
                                        src="/public/<%= theCache.settings["imageFolder"] %>/icon_del.gif"
                                        alt="<%= lang['delete'] %>"/></a>
                            <% } %>
                        </div>
                    </div>
                    <div id="comm_<%= id %>" class="commentbox-content">
                        <% if(!hidden || theUser.id == theArticle.authorID ||
                                (theUser.id == authorID && authorID != 0)){ %>
                        <%= ubb.toHTML(helper.HTMLEncode(content), ubbFlags, "", true) %>
                        <% if(editMark){
                            var arrEdit = editMark.split("$|$");
                        %>
                        <div class="editmark">[<%= __('edited_by')+arrEdit[0]+__('at')+arrEdit[1] %>]</div>
                        <% } %>
                        <% }else{ %>
                        <div class="hidden-note"><%= __('hidden_comment') %></div>
                        <% } %>
                    </div>
                </div>
                <% }else{ %>
                <div class="trackbackbox" id="trackback<%= id %>">
                    <a name="trackback<%= id %>"></a>
                    <div class="trackbackbox-title">
                        <img src="/public/<%= theCache.settings["imageFolder"] %>/icon_trackback.gif"
                             alt="<%= __('trackback') %>"/>
                        <b><a href="<%= helper.HTMLEncode(url) %>" target="_blank"><%= helper.HTMLEncode(title) %></a></b>
                        <div class="trackbackbox-label">
                            [ <%= helper.HTMLEncode(blog) %> | <%= helper.getDateTimeString("YY-MM-DD hh:ii:ss", time) %>
                            <% if(theUser.groupID == 1){ %>
                            | <%= IP %>
                            <% } %>
                            ]
                            <% if(theUser.loggedIn && (theUser.rights["delete"] > 1 ||
                                    (theUser.rights["delete"] == 1 && theUser.id == theArticle.authorID))){ %>
                            &nbsp;<a href="trackback.asp?act=delete&amp;id=<%= id %>"
                                     onclick="return confirm('<%= __('confirm_delete_trackback') %>?')"><img
                                        src="/public/<%= theCache.settings["imageFolder"] %>/icon_del.gif"
                                        alt="<%= lang['delete'] %>"/></a>
                            <% } %>
                        </div>
                    </div>
                    <div class="trackbackbox-content"><%= helper.HTMLEncode(excerpt) %></div>
                </div>
                <% }
                }
                }
                %>
                <% if(intPageSize > 0){ %>
                <div class="comment-pages">
                    <%- strPageLinks %>
                </div>
                <% } %>
                <% }else{ %>
                <div class="no-comment-box"><%= __('no_comment') %></div>
                <% } %>
            </div>
            <br/>
            <a name="commentbox"></a>
            <% if(theArticle.locked || theArticle.category.locked || theCache.settings["enableComment"] != 1){ %>
            <div class="no-comment-box"><%= __('comment_disabled') %></div>
            <% }else{ %>
            <%# commentForm(__('post_comment'), "comment.asp?act=save&amp;logid=" + theArticle.id); %>
            <% } %>

        </div>
    </div>
    <% include ../sidebar %>
    <div class="clear"></div>
</div>

<% include ../pageFooter %>
